<html>
<head><meta charset="utf-8"><title>incremental const_evaluatable_checked bug · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html">incremental const_evaluatable_checked bug</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="221163894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221163894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221163894">(Dec 29 2020 at 20:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/77650">#77650</a> and <a href="https://github.com/rust-lang/rust/issues/77708">#77708</a> are most probably caused by us calling <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.try_unify_abstract_consts"><code>query try_unify_abstract_consts</code></a> with substs containing inference variables.</p>



<a name="221163968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221163968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221163968">(Dec 29 2020 at 20:22)</a>:</h4>
<p>inference variables are not allowed in the query system, so we have 3 different ways to deal with this</p>



<a name="221164007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164007">(Dec 29 2020 at 20:23)</a>:</h4>
<ol>
<li>replace them with placeholders or fresh variables</li>
</ol>



<a name="221164125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164125">(Dec 29 2020 at 20:25)</a>:</h4>
<p>this requires an inference context so isn't really feasable</p>



<a name="221164152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164152">(Dec 29 2020 at 20:26)</a>:</h4>
<ol start="2">
<li>move <code>AbstractConst</code>s into <code>rustc_middle</code>  and change <code>try_unify_abstract_consts</code> to an ordinary method</li>
</ol>



<a name="221164219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164219">(Dec 29 2020 at 20:26)</a>:</h4>
<p>probably the easiest even if it's a bit annoying as the logic for <code>AbstractConst</code>s doesn't otherwise need to be in <code>rustc_middle</code></p>



<a name="221164264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164264">(Dec 29 2020 at 20:28)</a>:</h4>
<ol start="3">
<li>add something similar to <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/query/struct.Providers.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/query/struct.Providers.html</a> for ordinary functions</li>
</ol>



<a name="221164328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164328">(Dec 29 2020 at 20:28)</a>:</h4>
<p>this allows us to keep all of the logic outside of <code>rustc_middle</code> while still solving this issue</p>



<a name="221164346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164346">(Dec 29 2020 at 20:29)</a>:</h4>
<p>first, <span class="user-mention" data-user-id="124288">@oli</span> what do you think is the best approach for now?</p>



<a name="221164474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164474">(Dec 29 2020 at 20:30)</a>:</h4>
<p>second, <span class="user-mention" data-user-id="326189">@jknodt</span> <span class="user-mention" data-user-id="366818">@Pedro Mendes</span> <span class="user-mention" data-user-id="351972">@Ethan Brierley</span> <span class="user-mention" data-user-id="256313">@Hameer Abbasi</span> is one of you interested in working on this? pm me if you don't want to get pinged for stuff like this</p>



<a name="221164722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221164722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ethan Brierley <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221164722">(Dec 29 2020 at 20:35)</a>:</h4>
<p>I would like to look into this one. Also note, I love getting pinged for this kind of thing :).</p>
<p>I am going to bed now so will take a proper look tomorrow.</p>



<a name="221169379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221169379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221169379">(Dec 29 2020 at 21:36)</a>:</h4>
<p>Option 4: use one of the query modifiers to make the query just be a normal function</p>



<a name="221169544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221169544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221169544">(Dec 29 2020 at 21:38)</a>:</h4>
<p>I'm not sure that's possible,  but I remember lots of fun modifiers like <code>no_hash</code> and <code>always_evaluate</code> or sth</p>



<a name="221209422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221209422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221209422">(Dec 30 2020 at 12:34)</a>:</h4>
<p>hmm, I am not sure if reusing queries for this is clean approach as this seems to be a fundamental property of queries <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="221209474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221209474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221209474">(Dec 30 2020 at 12:36)</a>:</h4>
<p>i do think using the third way and reusing that new <code>struct</code> for other functions which are currently in <code>rustc_middle</code> is probably a good change</p>



<a name="221209520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221209520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221209520">(Dec 30 2020 at 12:36)</a>:</h4>
<p>so that we pretty much end up with <code>rustc_middle</code> being only used for query and type definitions and move most of the complex logic into separate crates</p>



<a name="221211074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221211074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221211074">(Dec 30 2020 at 13:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug/near/221209474">said</a>:</p>
<blockquote>
<p>i do think using the third way and reusing that new <code>struct</code> for other functions which are currently in <code>rustc_middle</code> is probably a good change</p>
</blockquote>
<p>Yea, I thought we already had queries that were behaving like that, but turns out I had a misunderstanding of <code>always_evaluate</code> queries (that attribute means we always run it, even if all input is green)</p>



<a name="221211081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221211081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221211081">(Dec 30 2020 at 13:09)</a>:</h4>
<p>if there's no rush, we should implement 3.</p>



<a name="221211087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221211087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221211087">(Dec 30 2020 at 13:09)</a>:</h4>
<p>but that requires an MCP</p>



<a name="221262567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/incremental%20const_evaluatable_checked%20bug/near/221262567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hameer Abbasi <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/incremental.20const_evaluatable_checked.20bug.html#221262567">(Dec 31 2020 at 01:51)</a>:</h4>
<p>I’d also say I love getting pinged. 💛 But I’m currently away from home and with family, so it’s a bit difficult for me to allocate time to this. I’ll be back 17 January and then I’ll work more on this.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>